use AppleScript version "2.4" -- Yosemite (10.10) or lateruse scripting additions-- http://veritrope.com/code/toggle-an-app-on-off--ENTER THE NAME OF THE APP --THAT YOU WOULD LIKE TO TOGGLE--IN THE PROPERTY BELOW...--property app_Name : ""------if appIsRunning(app_Name) then--	do shell script "killall " & (quoted form of app_Name)--else--	do shell script "open -a " & (quoted form of app_Name)--end if----on appIsRunning(appName)--	tell application "System Events" to (name of processes) contains appName--end appIsRunningtell application "System Events"	set frontProcess to first process whose frontmost is true	set visible of frontProcess to falseend tell